package com.qf.android.huihui.bean.domestic;

import android.content.Context;
import android.content.Intent;
import android.databinding.ObservableInt;
import android.support.v4.view.PagerAdapter;

import com.google.gson.annotations.Expose;
import com.qf.android.huihui.BR;
import com.qf.android.huihui.R;
import com.qf.android.huihui.adapter.domestic.CommentPagerAdapter;
import com.qf.android.huihui.view.activity.WebviewActivity;

import java.util.List;


public class DataEntity {

    private List<TopBean> top;
    private List<BottomBean> bottom;
    @Expose(serialize = false, deserialize = false)
    private PagerAdapter adapter;
    @Expose(serialize = false,deserialize = false)
    public ObservableInt currentPage=new ObservableInt(0);
    public ObservableInt getCurrentPage() {
        return currentPage;
    }


    public PagerAdapter getAdapter() {
        if (adapter == null) {
            adapter = new CommentPagerAdapter<>(top, R.layout.domestic_pager_image, BR.image);
        }
        return adapter;
    }

    public List<TopBean> getTop() {
        return top;
    }

    public void setTop(List<TopBean> top) {
        this.top = top;
    }

    public List<BottomBean> getBottom() {
        return bottom;
    }

    public void setBottom(List<BottomBean> bottom) {
        this.bottom = bottom;
    }

    public static class TopBean {
        /**
         * title : 吃货の幸福时刻！
         * url : http://www.huihui.cn/huodongnew/chihuo
         * imageUrl : http://oimageb6.ydstatic.com/image?id=-2191543044056367259&amp;product=gouwu
         */

        private String title;
        private String url;
        private String imageUrl;

        public void login(Context context) {
            Intent intent=new Intent(context, WebviewActivity.class);
            intent.putExtra("url",url);
            context.startActivity(intent);

        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getImageUrl() {
            return imageUrl;
        }

        public void setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
        }
    }

    public static class BottomBean {


        private String title;
        private String url;
        private String imageUrl;
        public void bottom(Context context) {
            Intent intent=new Intent(context, WebviewActivity.class);
            intent.putExtra("url",url);
            context.startActivity(intent);

        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getImageUrl() {
            return imageUrl;
        }

        public void setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
        }
    }
}
